<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>[|.pageTitle|]</title>
    [|if .zTree|]
    <link rel="stylesheet" href="/static/zTree3/css/demo.css?t=5" type="text/css">
    <link rel="stylesheet" href="/static/zTree3/css/zTreeStyle/zTreeStyle.css" type="text/css">
    [|end|]
    <meta charset="utf-8">
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/css/main.css">
    <script src="/static/layui/layui.js?s=36"></script>
    <script src="/static/js/main.js?s=2124"></script>
    <script src="/static/js/echarts.js"></script>
</head>
<body>
<div class="layui-layout layui-layout-admin" style="margin-top: 20px;">
    <form class="layui-form"  style="padding-left:40px;">
        <div class="layui-inline  layui-form-item">
            <div class="layui-input-inline" style="text-align: left;">
                <select name="usercondition" id = "usercondition" lay-verify="required" lay-search="" readonly>
                    <option value="0">玩家推广号</option>
                    <option value="1">玩家登录名</option>
                    <option value="2">玩家昵称</option>
                    <option value="3">玩家UserID</option>
                </select>
            </div>
            <div class="layui-input-inline"  style="width:140px;">
                <input type="text" class="layui-input" id="userconditioninfo">
            </div>
            <label class="layui-form-label">分类：</label>
            <div class="layui-input-inline" style="width:120px;">
                <select name="userclasscondition" id = "userclasscondition" readonly >
                    <option value="0">--请选择--</option>
                    <option value="1">一类</option>
                    <option value="2">二类</option> 
                </select>
            </div> 
            <div class="layui-btn-group" >
                <button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="starquery">开始查询</button>
            </div>
    </div> 
         <br />
        <hr class="layui-bg-gray">
        <div>
            <p>
                <label id="" style="color:rgb(0, 0, 0);">总金币：</label>
                <label id="cursendcount0" style="color:red;">0</label>
                <label id="" style="color:rgb(0, 0, 0);">,当日赠送：</label>
                <label id="cursendcount1" style="color:red;">0</label>
                <label id="" style="color:rgb(0, 0, 0);">,当日送笔数：</label>
                <label id="cursendcount2" style="color:red;">0</label>
            </p>
        </div>

    </form>


    <table  class="layui-table" id="extermervipusrs" lay-size="sm" lay-filter="layfilterextermervipusrs"> </table> 
    <script type="text/html" id="extermervipusrsbar">
        <div class="layui-btn-group" > 
             <td> 
                <a class="layui-btn-xs" lay-event="delvip" >删除vip</a>
                <a class="layui-btn-xs" lay-event="editvip">编辑vip</a>
            </td>
        </div>
    </script>

</div>
<script>
    var $;

    layui.config({
            base : "js/"
    }).use(['form','element','layer','jquery','table'], function(){
        var table = layui.table;
        var element = layui.element;
        var form = layui.form;
        var laydate = layui.laydate;
        $ = layui.jquery;
    //监听表格复选框选择
   // table.on('checkbox(demo)', function(obj){
    //   console.log(obj);
   // });

    //监听工具条
    ShowTablesDatas(table);
    ShowTitleDatas($)
    form.on('submit(starquery)', function(data) {
         
        //GetMyTables(table)
        ShowTablesDatas(table);
        ShowTitleDatas($)
        //layer.alert("添加血池值为0，请确认！", {
               //     title: '失败'
       // })
       
        
        return false;
    });

    //监听工具条
    table.on('tool(layfilterextermervipusrs)', function(obj){
        var data = obj.data;
       if(obj.event === 'editvip'){
            window.location.href="/extremevipmanage/extermevipuseredit.html?ServerID="+data.UserID
        } else if(obj.event === 'delvip'){
             
                layer.confirm('你真的要删除【'+data.UserNickName+'】('+ data.UserID + ') 至尊VIP么！' , function(index){
                    var jsData = {
                        'USER_ID':data.UserID
                        ,'CUR_LVSIGN':data.UserKind
                        ,'MODFY_LVSIGN':0
                    }
                      //  layer.alert(JSON.stringify(jsData), {
                        //    title: '最终的提交信息'
                       // }) 
                       // return false;
                    $.post('[|urlfor "ExtremevipManageController.ModifyVipInfo"|]', jsData, function (out) {
                        if(out.status == 0)
                        {
                            layer.alert(out.message, {icon: 1},function(index){
                                layer.close(index);
                                //window.location.reload();
                                // window.location.reload();
                                ShowTablesDatas(table);
                                ShowTitleDatas($)
                                return false;
                            })
                        }else
                         {
                            layer.msg(out.message)
                        }
                    }, "json");
                });
        }
    });



       

    return false;
}); 


function ShowTablesDatas(thisTabble){
 
    var dusercondition =  document.getElementById("usercondition");
    var duserconditioninfo = document.getElementById("userconditioninfo");
    var duserclasscondition =  document.getElementById("userclasscondition");
    thisTabble.render({
        elem:'#extermervipusrs'
        ,url:'/extremevipmanage/extermevipuserlisttable'
        ,where: {
                d_usercondition: dusercondition.value
                ,d_usercondition_info: duserconditioninfo.value
                ,d_userclass_condition: duserclasscondition.value
        }
        ,cols: [[ //标题栏
            {field:'UserID',title:'推广号',width:120}
            ,{field:'UserNickName',title:'昵称',width:170}
            ,{field:'AutoGraph',title:'签名',width:400}
            ,{field:'WriteTime',title:'添加时间',width:160}
            ,{field:'UserKind',title:'分类',width:80}
            ,{field:'Glods',title:'金币',width:150}
            ,{field:'Diamonds',title:'钻石',width:150}
            ,{field:'Platform',title:'代理平台',width:100}
            ,{field:'GitfCount',title:'礼物笔数',width:120}
            ,{field:'LastweekCount',title:'近一周总额',width:120}
            ,{title:'',width:1,align:'center',rules:'all',toolbar: '#extermervipusrsbar' }
                ]] 
        ,skin: 'row' //表格风格
        ,even: true
        ,page: true //是否显示分页
        ,limits: [50,100,200]
        ,limit: 100//每页默认显示的数量
        ,width: 'full-10'
        ,rules: 'all'
        ,height: 'full-205'
    });
}
function ShowTitleDatas(sends){
    var dusercondition =  document.getElementById("usercondition");
    var duserconditioninfo = document.getElementById("userconditioninfo");
    var duserclasscondition =  document.getElementById("userclasscondition");
    var jsData = {
            'd_usercondition':dusercondition.value
            ,'d_usercondition_info':duserconditioninfo.value
            ,'d_userclass_condition':duserclasscondition.value
        }
        //layer.alert(JSON.stringify(jsData), {
           //     title: '最终的提交信息'
      // }) 
    sends.post('[|urlfor "ExtremevipManageController.GetTitleDatas"|]', jsData, function (out) {
        if(out.code == 0)
        {
  
            if(out.data.length > 0)
            {
                var dusercondition0 =  document.getElementById("cursendcount0");
                dusercondition0.innerHTML=out.data[0].alluseScore;             
                var dusercondition1 =  document.getElementById("cursendcount1");
                dusercondition1.innerHTML=out.data[0].SellScore; ;               
                var dusercondition2 =  document.getElementById("cursendcount2");
                dusercondition2.innerHTML=out.data[0].SellCount; ; 
            }    
            return false;
        }
        layer.msg(out.message)
    }, "json"); 
}


</script>
</body>
</html>